# Maintainer: Frederik Schwan <freswa at archlinux dot org>

pkgname=autotiling-rs
pkgver=0.1.3
pkgrel=1
pkgdesc='Automatically alternates container layouts between horizontal and vertical'
arch=('loong64' 'x86_64')
url='https://github.com/ammgws/autotiling-rs'
license=('MIT')
makedepends=('rust')
source=("https://github.com/ammgws/autotiling-rs/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
        "https://raw.githubusercontent.com/ammgws/autotiling-rs/master/LICENSE")
b2sums=('3bffa4f9beef917c1ac731507e61ac716164829b1ce038e20708ca8d0511dd9a43827162d5e0e8b1ef417b52d56368aa38d77541e764880aeb35f9171a552c0b'
        '4ab8cee196ff28a84856350bd3dcfd7b16ce099a8ae80300c2ad34a53007dc788d304ab1553163ed0586c89211ca853310a8f0074acbe6fc04cf6f1ad5e81921')

prepare() {
  cd ${pkgname}-${pkgver}
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}-${pkgver}
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --release --locked
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm755 target/release/${pkgname} "${pkgdir}"/usr/bin/${pkgname}
  # use with >=0.1.4
  # install -Dm755 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
  install -Dm755 ../LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}

